// app.js
App({
  onLaunch() {
    //初始化部分缓存
    //商家入驻申请缓存
    wx.removeStorageSync('BusinessJoinImg');
    wx.removeStorageSync('BusinessJoinMenuArr');

    //计算自定义导航栏的高度
    let menuButtonObject = wx.getMenuButtonBoundingClientRect();
    wx.getSystemInfo({
      success: res => {
        // console.log(res)
        let statusBarHeight = res.statusBarHeight,
          navTop = menuButtonObject.top, //胶囊按钮与顶部的距离
          navHeight = statusBarHeight + menuButtonObject.height + (menuButtonObject.top - statusBarHeight) * 2; //导航高度
        this.globalData.screenHeight = res.screenHeight;
        this.globalData.hoverHeightNotab = res.screenHeight - navHeight;
        this.globalData.navHeight = navHeight;
        this.globalData.navTop = navTop;
        this.globalData.windowHeight = res.windowHeight;
        this.globalData.tabbarHeight = (res.screenHeight - res.windowHeight - statusBarHeight) * res.pixelRatio;
        this.globalData.device = res.model
      },
      fail(err) {
        // console.log(err);
      }
    })

    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })
  },
  globalData: {
    //坐标信息
    coordinate:'',
    //接口域名
    urls: 'https://yjk.lphp.site/',
    //测试用 用户信息
    userInfo: {},
    accountReg: /^[a-zA-Z][a-zA-Z0-9_]{4,15}$/,
    passwordReg: /^[a-zA-Z]\w{5,31}$/,
    imageApplyed: false,
  }
})